<?php if (!defined('SYSTEM_ROOT')) {
    die('Insufficient Permissions');
}
/*
Plugin Name: 自定义签到微信推送
Version: 0.1
Plugin URL: https://github.com/houchang1991/tieba_serverchan
Description: 每日用户签到微信推送
Author: houchang1991
Author Email: houchang1991@gmail.com
For: V3.8+
*/
function tieba_serverchan_setting()
{
    if (option::get('tieba_serverchan_default_open') == 1) {
        $is_open = option::uget('tieba_serverchan_enable') == 'off' ? false : true;
    } else {
        $is_open = option::uget('tieba_serverchan_enable') == 'on' ? true : false;
    }
    $sckey = option::uget('tieba_serverchan_sckey');

    ?>
    <tr>
    <td>每日签到微信推送报告</td>
    <td>
        <input type="radio" name="tieba_serverchan_enable"
               value="on" <?php echo $is_open ? 'checked' : ''; ?> > 开启每日签到微信推送<br/>
        <input type="radio" name="tieba_serverchan_enable"
               value="off" <?php echo $is_open ? '' : 'checked'; ?> > 关闭每日签到微信推送
    </td>
    </tr>
    <tr>
    <td>每日签到微信推送SCKEY</td>
    <td>
        <input type="text" name="tieba_serverchan_sckey" <?php echo "value=" . $sckey; ?> >
    </td>
    </tr>
    <?php
}

function tieba_serverchan_set()
{
    global $PostArray;
    if (!empty($PostArray)) {
        $PostArray[] = 'tieba_serverchan_enable';
        $PostArray[] = 'tieba_serverchan_sckey';
    }
}

addAction('set_save1', 'tieba_serverchan_set');
addAction('set_2', 'tieba_serverchan_setting');
?>